<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org"
      xmlns:shiro="http://www.thymeleaf.org/thymeleaf-extras-shiro">
<head>
    <meta charset="UTF-8">
    <title>首页</title>
</head>
<body>

<div th:if="${session.user == null}">
    <h2>登录</h2>
    <form th:action="@{/auth/sublogin}">

        <input name="userName">
        <input name="password" type="password">
        <input type="submit" value="登录">
    </form>
</div>
<hr>
<div th:if="${session.user != null}">
    <h2 th:text="${session.user.username}"></h2>
    <a th:href="@{/auth/logout}">退出登录</a> &nbsp;
    <div shiro:hasPermission="demo:p1">
        <a th:href="@{/demo/p1}">p1</a> &nbsp;
    </div>
    <div shiro:hasPermission="demo:p2">
        <a th:href="@{/demo/p2}">p2</a>
    </div>
</div>
</body>
</html>